<?php
	
	require_once 'config.php';
	if(isset($_POST['room'])){
		$roomId = $_POST['room'];
		
		require_once('php/Communicator.php');
		$cmm = new Communicator;
		$group = json_decode(file_get_contents("room/$roomId/group"),true);
		
		$members = $group['members'];
		$groupName = $group['name'];
		
		for($i=0, $iMax=count($members); $i<$iMax; $i++){
			$member = $members[$i];
			$memberId = $member['id'];
			
			$cmm->sendNotification($memberId,'Uma sala foi criada no grupo '.$groupName,'lobby.php');
		}
	}

?>